package com.kid.keep.dao.item;

import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.kid.keep.bo.ChildCheckItemBO;
import com.kid.keep.po.ChildCheckItem;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @Description ChildCheckItemRepository
 * @Author JOHN
 * @Create 2019-01-10
 * @Since 1.0.0
 */
@Repository
public class ChildCheckItemRepository extends ServiceImpl<IChildCheckItemMapper, ChildCheckItem> implements IChildCheckItemRepository {


    @Override
    public int updateByIdAndReportId(ChildCheckItem childCheckItem, Long id, Long reportId) {
        return this.baseMapper.update(childCheckItem, new UpdateWrapper<ChildCheckItem>().lambda().eq(ChildCheckItem::getId, id).eq(ChildCheckItem::getReportId, reportId));
    }

    @Override
    public ChildCheckItemBO findByIdAndReportId(Long id,Long reportId) {
        return this.baseMapper.findByIdAndReportId(id,reportId);
    }

    @Override
    public List<ChildCheckItemBO> findAllByReportId(Long reportId) {
        return this.baseMapper.findAllByReportId(reportId);
    }

    @Override
    public List<ChildCheckItemBO> findAllByReportIdAndDetectionType(Long reportId, Integer detectionType) {
        return this.baseMapper.findAllByReportIdAndDetectionType(reportId, detectionType);

    }

    @Override
    public ChildCheckItemBO getByIdAndReportId(Long id, Long reportId) {
        return this.baseMapper.getByIdAndReportId(id,reportId);
    }

    @Override
    public int updateResultByReportId(Long reportId) {
        return this.baseMapper.updateResultByReportId(reportId);
    }
}


